var feedcontainer=document.getElementById("feeddiv")
var feedurl="http://www.cse.chalmers.se/research/group/idc/ituniv/courses/11/idproj/blog/?feed=rss2"
var feedlimit=5
var rssoutput="<b>Latest blog posts:</b><br /><ul>"

function rssfeedsetup(){
	var feedpointer=new google.feeds.Feed(feedurl) //Google Feed API method
	feedpointer.setNumEntries(feedlimit) //Google Feed API method
	feedpointer.load(displayfeed) //Google Feed API method
}

function displayfeed(result){
	if (!result.error){
	var thefeeds=result.feed.entries
	for (var i=0; i<thefeeds.length; i++)
		rssoutput+="<li><a href='" + thefeeds[i].link + "'>" + thefeeds[i].title + "</a></li>"
	rssoutput+="</ul>"
	feedcontainer.innerHTML=rssoutput
}
else
	alert("Error fetching feeds!")
}

window.onload=function(){
	rssfeedsetup()
}
